<?php

use Illuminate\Support\Facades\Route;
use App\Http\Middleware\VerifyAdmin;
use App\Http\Middleware\VerifyWorker;
use App\Http\Middleware\VerifyMember;

//管理员登陆注册
Route::group([
    'middleware' => 'api',
    'prefix' => 'api/admin'
], function ($router) {
    Route::post('/register',[\App\Http\Controllers\Admin\Daman\LoginController::class,'register']);
    Route::post('/login',[\App\Http\Controllers\Admin\Daman\LoginController::class,'login']);
});

/*
 * 后台管理
 * */
Route::group(['middleware' => VerifyAdmin::class, 'prefix' => 'api/admin'], function ($router) {

    //管理员管理
    Route::group(['prefix' => 'user'], function ($router) {
        Route::get('/',[\App\Http\Controllers\Admin\Daman\UserController::class,'index']);
        Route::post('/add',[\App\Http\Controllers\Admin\Daman\UserController::class,'add']);
        Route::post('/edit',[\App\Http\Controllers\Admin\Daman\UserController::class,'edit']);
        Route::post('/del',[\App\Http\Controllers\Admin\Daman\UserController::class,'del']);

        //部门管理
        Route::group(['prefix' => 'branch'], function ($router) {
            Route::get('/',[\App\Http\Controllers\Admin\Daman\BranchController::class,'index']);
            Route::post('/add',[\App\Http\Controllers\Admin\Daman\BranchController::class,'add']);
            Route::post('/edit',[\App\Http\Controllers\Admin\Daman\BranchController::class,'edit']);
            Route::post('/del',[\App\Http\Controllers\Admin\Daman\BranchController::class,'del']);
        });

    });


    //菜单api管理
    Route::group(['prefix' => 'menu'], function ($router) {
        Route::get('/',[\App\Http\Controllers\Admin\Daman\MenuController::class,'index']);
        Route::post('/add',[\App\Http\Controllers\Admin\Daman\MenuController::class,'add']);
        Route::post('/edit',[\App\Http\Controllers\Admin\Daman\MenuController::class,'edit']);
        Route::post('/del',[\App\Http\Controllers\Admin\Daman\MenuController::class,'del']);
    });
    //角色管理
    Route::group(['prefix' => 'role'], function ($router) {
        Route::get('/',[\App\Http\Controllers\Admin\Daman\RoleController::class,'index']);
        Route::post('/add',[\App\Http\Controllers\Admin\Daman\RoleController::class,'add']);
        Route::post('/edit',[\App\Http\Controllers\Admin\Daman\RoleController::class,'edit']);
        Route::post('/del',[\App\Http\Controllers\Admin\Daman\RoleController::class,'del']);
        Route::post('/delMenu',[\App\Http\Controllers\Admin\Daman\RoleController::class,'delMenu']);
    });
    //权限管理
    Route::any('/getRule',[\App\Http\Controllers\Admin\Daman\MenuController::class,'getRule']);

    //我的工作
    Route::group(['prefix' => 'workflow'], function ($router) {
        //新建工资列表
        Route::get('/getWorkList',[\App\Http\Controllers\Api\Ddaman\WorkflowController::class,'getWorkList']);
        //待办事项
        Route::get('/getTodoList',[\App\Http\Controllers\Api\Ddaman\WorkflowController::class,'getTodoList']);
        //审批工作
        Route::post('/approveWork',[\App\Http\Controllers\Api\Ddaman\WorkflowController::class,'approveWork']);
        //请假类型
        Route::get('/getLeaveType',[\App\Http\Controllers\Api\Ddaman\WorkflowController::class,'getLeaveType']);
        //流程跟踪
        Route::get('/getProcessTracking',[\App\Http\Controllers\Api\Ddaman\WorkflowController::class,'getProcessTracking']);
        //查看信息
        Route::get('/getProcessInfo',[\App\Http\Controllers\Api\Ddaman\WorkflowController::class,'getProcessInfo']);

        Route::get('/',[\App\Http\Controllers\Api\Ddaman\WorkflowController::class,'index']);
        Route::post('/add',[\App\Http\Controllers\Api\Ddaman\WorkflowController::class,'add']);
        Route::post('/edit',[\App\Http\Controllers\Api\Ddaman\WorkflowController::class,'edit']);
        Route::post('/del',[\App\Http\Controllers\Api\Ddaman\WorkflowController::class,'del']);

        //流程设计
        Route::group(['prefix' => 'design'], function ($router) {
            Route::get('/getWorkflowType',[\App\Http\Controllers\Admin\Daman\WorkflowDesignController::class,'getWorkflowType']);

            Route::get('/',[\App\Http\Controllers\Admin\Daman\WorkflowDesignController::class,'index']);
            Route::post('/add',[\App\Http\Controllers\Admin\Daman\WorkflowDesignController::class,'add']);
            Route::post('/edit',[\App\Http\Controllers\Admin\Daman\WorkflowDesignController::class,'edit']);
            Route::post('/del',[\App\Http\Controllers\Admin\Daman\WorkflowDesignController::class,'del']);
        });

        //流程步骤
        Route::group(['prefix' => 'flow'], function ($router) {
            Route::get('/',[\App\Http\Controllers\Admin\Daman\WorkflowFlowController::class,'index']);
            Route::post('/add',[\App\Http\Controllers\Admin\Daman\WorkflowFlowController::class,'add']);
            Route::post('/edit',[\App\Http\Controllers\Admin\Daman\WorkflowFlowController::class,'edit']);
            Route::post('/del',[\App\Http\Controllers\Admin\Daman\WorkflowFlowController::class,'del']);
        });

    });

});


/*
 * 第三方
 * */
Route::group(['prefix' => 'api'], function ($router) {

    //订单支付
    Route::post('/orderPay',[\App\Http\Controllers\Daman\PayController::class,'orderPay']);
    //保证金支付
    Route::post('/depositPay',[\App\Http\Controllers\Daman\PayController::class,'depositPay']);

    //微信
    Route::group(['prefix' => 'wechat'], function ($router) {

        //微信
        Route::any('/',[App\Http\Controllers\Wechat\WechatController::class,'getOfferWorker']);
        //微信支付 商品支付
        Route::post('/pay',[App\Http\Controllers\Wechat\WechatController::class,'wechatPay']);
        //微信支付 保质金支付
        Route::post('/depositPay',[App\Http\Controllers\Wechat\WechatController::class,'depositPay']);
        //微信支付回调
        Route::any('/notifyPay',[App\Http\Controllers\Wechat\WechatController::class,'notifyPay']);
        //微信登陆
        Route::any('/wechatLogin',[App\Http\Controllers\Wechat\WechatController::class,'wechatLogin']);

        //微信调试
        Route::any('/wechatDebug',[App\Http\Controllers\Wechat\WechatController::class,'wechatDebug']);
    });

    //支付宝
    Route::group(['prefix' => 'alipay'], function ($router) {

        //支付宝支付 商品支付
        Route::post('/pay',[\App\Http\Controllers\Daman\AlipayController::class,'alipayPay']);
        //支付宝支付 保质金支付
        Route::post('/depositPay',[\App\Http\Controllers\Daman\AlipayController::class,'depositPay']);
        //支付宝支付回调
        Route::any('/notifyPay',[\App\Http\Controllers\Daman\AlipayController::class,'notifyPay']);
        //支付宝调试
        Route::any('/wechatDebug',[\App\Http\Controllers\Daman\AlipayController::class,'wechatDebug']);
    });
});


//上传文件 Obs 测试
Route::any('/api/uploadFile',[\App\Http\Controllers\Api\Ddaman\HuaweiController::class,'uploadImgAndFile']);

Route::group([
    'prefix' => 'dm'
], function ($router) {

    Route::get('/obs', function () {
        return view('obs.obs');
    });

    //队列测试
    Route::get('/sendQueue',[\App\Http\Controllers\Daman\DmController::class,'sendQueue']);

    //华为云身份验证
    Route::get('/getIdcard',[\App\Http\Controllers\Daman\DmController::class,'getIdcard']);
    //华为云 文字识别- 营业执照识别
    Route::get('/getOcr',[\App\Http\Controllers\Daman\DmController::class,'getOcr']);

    //极光推送
    Route::get('/pushNews',[\App\Http\Controllers\Daman\DmController::class,'pushNews']);

    //消息任务
    Route::get('/minuteCrontab',[\App\Http\Controllers\Daman\DmController::class,'minuteCrontab']);

    //消息任务
    Route::get('/exports',[\App\Http\Controllers\Daman\DmController::class,'exports']);

    //导出商品
    Route::any('/exportProduct',[ProductController::class,'exportProduct']);

});

Route::group([
    'middleware' => 'api',
    'prefix' => 'api'
], function ($router) {

    Route::post('/getQrcode',[\App\Http\Controllers\Api\Common::class,'getQrcode']);
    Route::get('/getSendMessage',[\App\Http\Controllers\Api\Common::class,'getSendMessage']);
});



